@echo off
REM SPDX-License-Identifier: GPL-3.0-or-later
REM Copyright (C) 2024 你的名字或你的组织名
REM This is free software, see the LICENSE file for details.
REM https://www.gnu.org/licenses/gpl-3.0.html
chcp 65001 >nul
setlocal enabledelayedexpansion

:start
cls
echo ================================
echo     执行次数设置
echo ================================
set /p "count=请输入要执行的次数: "

REM 验证输入是否为数字
echo !count!|findstr /r "^[0-9]*$" >nul
if errorlevel 1 (
    echo 错误：请输入有效的数字！
    timeout /t 2 /nobreak >nul
    goto start
)

if "!count!"=="" (
    echo 错误：输入不能为空！
    timeout /t 2 /nobreak >nul
    goto start
)

if !count! equ 0 (
    echo 错误：执行次数不能为0！
    timeout /t 2 /nobreak >nul
    goto start
)

echo.
echo 即将执行 !count! 次 java TripleDoublePinyinKeygen_UUID_AllRandom
echo 按任意键开始执行，按 Ctrl+C 取消...
pause >nul

REM 执行指定次数的Java命令
for /l %%i in (1,1,!count!) do (
    echo.
    echo [执行第 %%i 次]
    java TripleDoublePinyinKeygen_UUID_AllRandom
    if errorlevel 1 (
        echo.
        echo 错误：Java命令执行失败！
        echo 按任意键退出...
        pause >nul
        exit /b 1
    )
)

echo.
echo ================================
echo 所有执行已完成！
pause >nul
exit /b 0